@model IEnumerable<Order>

@{
    var pageName = "Orders";
    ViewData["Title"] = pageName;
}

<h2>@pageName</h2>

@if (Model.Count() <= 0)
{
    <h3>You haven't created any @pageName yet...</h3>
}


<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.FirstName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.LastName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.AddressLine1)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ZipCode)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.City)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.State)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Country)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.PhoneNumber)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.OrderTotal)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.OrderPlaced)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Email)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.User)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.FirstName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LastName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AddressLine1)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ZipCode)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.City)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.State)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Country)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.PhoneNumber)
                </td>
                <td>
                    @item.OrderTotal.ToString("c")
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.OrderPlaced)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Email)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.User.Email)
                </td>
                <td>
                    @*<a asp-action="Edit" asp-route-id="@item.OrderId">Edit</a> |*@
                    <a asp-action="Details" asp-route-id="@item.OrderId" class="btn btn-info">Details</a> |
                    <a asp-action="Delete" asp-route-id="@item.OrderId">Delete</a>
                </td>
            </tr>
        }
    </tbody>
</table>
